{% macro render_pagination(pagination, endpoint) %}
<nav aria-label="Page navigation">
    <ul class="pagination">
        <li class="{% if not pagination.prev_num %}disabled{% endif %}">
            <a href="{% if not pagination.prev_num %} # {%else%} {{url_for(endpoint, page=pagination.prev_num)}} {% endif %}" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
        </li>
        {% for page in pagination.iter_pages() %}
            {% if page %}
                {% if page != pagination.page %}
                    <li><a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a></li>
                {% else %}
                    <li class="active"><a href="#">{{ page }}</a></li>
                {% endif %}
            {% else %}
                <li><span class=ellipsis>…</span></li>
            {% endif %}
        {% endfor %}
        <li class="{% if not pagination.next_num %}disabled{% endif %}">
            <a href="{% if not pagination.next_num %} # {% else %} {{url_for(endpoint, page=pagination.next_num)}} {% endif %}" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>
    </ul>
</nav>
{% endmacro %}